import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
from selenium.webdriver.support.select import Select

testCase = "DBshop032_商品管理商品标签特定商品标签_删除"
firefox = openBrowser(url)
firefox.get(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu3(firefox, "商品管理", "商品标签", "特定商品标签")

# 1.点击“删除”按钮，确定删除，删除成功。
firefox.find_element_by_xpath("(//a[text()='删除'])[1]").click()
time.sleep(5)
firefox.switch_to.alert.accept()  # 处理js弹框，点击确定按钮
print("删除成功待验证")
time.sleep(2)


try:
    firefox.find_element_by_xpath("//*[contains(text(),'2F商品')]")
    if firefox.find_element_by_xpath("//*[contains(text(),'首页2F商品')]"):
        print("测试失败")
        writeLog("%s 测试失败" % testCase)
        getPhoto(firefox)
except:
    writeLog("%s 测试通过" % testCase)
    print("测试通过")
firefox.quit()
